package com.bite.book.model;

import com.bite.book.enums.ResultCodeEnum;
import lombok.Data;

@Data
public class Result<T> {
    private ResultCodeEnum code;
    private String errMsg;
    private T data;

    //封装方法
    public static <T> Result<T> nologin(){
        //说明用户未登录
        Result result = new Result();
        result.setCode(ResultCodeEnum.NOLOGIN);
        result.setErrMsg("用户未登录");
        return result;
    }

    public static <T> Result<T> success(T data){
        //说明用户未登录
        Result result = new Result();
        result.setCode(ResultCodeEnum.SUCCESS);
        result.setErrMsg("");
        result.setData(data);
        return result;
    }
}
